﻿
@using MyData.Dto
@model HolidayDto
@{
    ViewBag.Title = "DepartView";
    Layout = "~/Views/Shared/_Index.cshtml";

}

<form id="form1">
    <div class="tools">
        <ul class="toolbar">
            <li class="click" onclick="fnSave()"><span><img src="../Content/UI/images/t02.png" /></span>保存</li>
        </ul>
    </div>
    <div class="formbody">
        <ul class="forminfo">
            <li>
                <label>假期名称:</label><input value="@Model.Name" type="text" class="dfinput" id="Name" name="Name" required />

            </li>
            <li>
                <label>开始日期:</label>
                <input type="date" class="dfinput Wdate" id="StartDate" style="height:34px" placeholder="结束日期" value="@Model.StartDate.ToString("yyyy-MM-dd")" />

            </li>
            <li>
                <label>结束日期:</label><input type="date" class="dfinput Wdate" id="EndDate" style="height:34px" placeholder="结束日期" value="@Model.EndDate.ToString("yyyy-MM-dd")" />

            </li>
            <li>
                <label>假期备注</label> <textarea cols="" rows="3" class="textinput" id="Remark">@Model.Remark</textarea>
            </li>
        </ul>
        <input type="hidden" id="Id" value="@Model.Id.ToString()" />
    </div>
</form>
<script type="text/javascript">
    function fnSave() {
        if ($('#form1').valid()) {
            $.post("../Holiday/SaveHoliday", queryParams(), function (result) {
                if (result.state == 1) {
                    layer.msg('操作成功');
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index)
                    parent.$("#table").bootstrapTable('refresh');
                }
                else {
                    layer.msg(result.message);
                }
            })
        }
    }
    function queryParams() {
        return {
            Name: $("#Name").val(),
            StartDate: $("#StartDate").val(),
            EndDate: $("#EndDate").val(),
            Remark: $("#Remark").val(),
            Id: $("#Id").val()
        };
    }
</script>

